home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / tcp / rxsocket.lha / rxsocket / examples / dsc.rexx < prev    next >
OS/2 REXX Batch file  |  2000-11-28  |  889b  |  32 lines

  1. /*
  2. client for the ds service, see ds.rexx
  3. */
  4.  
  5. l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then call err "rmh.library not found",1
  6. if AddLibrary("rexxsupport.library","rxsocket.library")~=0 then call err result "not found",1
  7.  
  8. sin.addrport = 10000
  9. sin.addraddr = "127.0.0.1"
  10.  
  11. sock = socket("INET","STREAM")
  12. if sock<0 then call err "can't create socket"
  13.  
  14. if connect(sock,"SIN")<0 then call err "can't connect"
  15.  
  16. request = "A"
  17. if send(sock,request)~=1 then call err "send error"
  18.  
  19. res=recv(sock,"BUF",256)
  20. if res<0 then call err "recv error"
  21. if res=0 then call err "connection closed",1
  22. else say buf
  23.  
  24. exit
  25. /***************************************************************************/
  26. err: procedure expose prg
  27. parse arg msg,ntdoerr
  28.     if ntdoerr~=1 then msg = msg "("ErrorString(errno())")"
  29.     say msg
  30.     exit
  31. /***************************************************************************/
  32.